package LinesCraft;

import java.util.Random;

public class Map extends LinesCraft {
	//properties of a room(location/chunk/block/fuck-yourself-and-call-it-however-you-fucking-want):
	
	
	
	//animals
	
	Mobs pig = new Mobs("Pig", false, rawPorkchop, rawPorkchop );
	Mobs cow = new Mobs("Cow", false, rawBeef, rawBeef);
	Mobs chicken = new Mobs("Chicken", false, feather, rawChicken);
	Mobs cat = new Mobs("Cat", false, null, null);
	Mobs wolf = new Mobs("Wolf", false, null, null);
	
	//hostiles
	
	Mobs skeleton = new Mobs("Skeleton", true, arrow, bone);
	Mobs zombie = new Mobs("Zombie", true, rawFlesh, rawFlesh);
	
	//resources
	int treeAmmo=0;
	int deepDirt=0;	//how deep you have to mine to get to stone
	// int height=0;	//totally forgot what I wanted with this :(
	int Coal=0;	//sometimes there is coal on the surface.
	
	//-
	boolean hasCave=false;
	boolean hasVillage=false;
	
	  // 0=plains, 1=forest  2=swamp 3=desert 4=jungle 5=taiga(has trees) 6=tundra(no trees)	7=hills
	
	Random RNG = new Random();
	private int biome;
	
	
	static int intLocX=500;
	static int intLocY=500;

	static Map[][] XY = new Map[1000][1000];

	void generateMap(){			//this is quite much the biggest part of the game, except if I make the save system. This is of course not finished yet.. but SpOOOOOON...
		for(int i=0; i<1000; i++){		//filling the matrix with map objects
			for(int j=0; j<1000; j++){
				XY[i][j]=new Map();
			}
		}


		for(int i=0; i<200; i++){
		int randomBiome = RNG.nextInt(8);
			for(int j=0; j<5; j++){
				for(int k=0; k<5; k++){
					// System.out.println(i+"  "+j + " " + k + " " + randomBiome);	//for debugging(it works but fuck you it will stay here.)
					
					//there goes every detail of the blocks:
					XY[j][k].biome=randomBiome;							
					/*
					int ranPig = RNG.nextInt(5);	//I will just generate new random numbers with a for, when I'm in the mood of map generating and shit...
					int ranCow = RNG.nextInt(5);
					int ranChicken = RNG.nextInt(5);
					int ranCat= RNG.nextInt(5);
					int ranWolf = RNG.nextInt(5);							
					 */
					/*if(XY[j][k].biome==0){
						int rn = RNG.nextInt(1000);
						//spawning mobs - 1=chicken 2=cow 3=pig 4=sheep 5=squid	6=wolf 7=cat 		8=creeper 9=enderman 10=skeleton 11=spider 12=zombie 
						//this will be solved with a for loop and with some changes on the spawn method.
						if(rn<150){
							XY[j][k].spawn(chicken, 1);
							if(rn<50){
								XY[j][k].spawn(chicken, 2);
								if(rn<20){
									XY[j][k].spawn(chicken, 3);
									if(rn<5){
										XY[j][k].spawn(chicken, 4);
									}
								}
							}
						}
					}*/
				}
			}
		}
	}
	
	
	void spawn(int mob, int ammount){	//	1=chicken 2=cow 3=pig 4=sheep 5=squid	6=wolf 7=cat 		8=creeper 9=enderman 10=skeleton 11=spider 12=zombie 
		
	}
	
	static Map location= XY[intLocX][intLocY];	//this will always store the very current location of the player

	
	static void showLoc(){	//maybe this method should also show the "entities" on the map and could be called with the "look" command
		System.out.println("Your coordinates are: \tX: " + intLocX + "\n\t\t\tY: " + intLocY);
	}
	
	
	
	
	
	/*static void go(String direction, int time){			//this was moved to the main class. I dunno why it's still here, but hey, why not?
		if(direction.equals("north")){
			intLocX=intLocX+1;
		}else if(direction.equals("south")){
			intLocX=intLocX-1;
		}else if(direction.equals("west")){
			intLocY = intLocY-1;
		}else if(direction.equals("east")){
			intLocY = intLocY+1;
		}else{
			System.out.println("You can't go that way.");
		}
		
		time++;
	}*/
	
	
}
